home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / wwais103 / sources.frm < prev    next >
Text File  |  1995-05-08  |  6KB  |  230 lines

  1. VERSION 2.00
  2. Begin Form sources_form 
  3.    BackColor       =   &H00808080&
  4.    Caption         =   "WAIS Sources"
  5.    ClientHeight    =   2985
  6.    ClientLeft      =   1305
  7.    ClientTop       =   3240
  8.    ClientWidth     =   7365
  9.    Height          =   3390
  10.    Left            =   1245
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form2"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2985
  16.    ScaleWidth      =   7365
  17.    Top             =   2895
  18.    Width           =   7485
  19.    Begin CommandButton src_delete 
  20.       Caption         =   "&Delete"
  21.       Height          =   375
  22.       Left            =   6360
  23.       TabIndex        =   4
  24.       Top             =   2520
  25.       Width           =   855
  26.    End
  27.    Begin CommandButton src_change 
  28.       Caption         =   "&Change"
  29.       Height          =   375
  30.       Left            =   5400
  31.       TabIndex        =   5
  32.       Top             =   2520
  33.       Width           =   855
  34.    End
  35.    Begin CommandButton src_add 
  36.       Caption         =   "&Add"
  37.       Height          =   375
  38.       Left            =   4440
  39.       TabIndex        =   3
  40.       Top             =   2520
  41.       Width           =   855
  42.    End
  43.    Begin CommandButton add_ok 
  44.       Caption         =   "&OK"
  45.       Height          =   375
  46.       Left            =   1080
  47.       TabIndex        =   1
  48.       Top             =   2520
  49.       Width           =   855
  50.    End
  51.    Begin CommandButton src_use 
  52.       Caption         =   "&Use"
  53.       Height          =   375
  54.       Left            =   120
  55.       TabIndex        =   2
  56.       Top             =   2520
  57.       Width           =   855
  58.    End
  59.    Begin ListBox s_source_list 
  60.       BackColor       =   &H00FFFFC0&
  61.       FontBold        =   0   'False
  62.       FontItalic      =   0   'False
  63.       FontName        =   "Terminal"
  64.       FontSize        =   9
  65.       FontStrikethru  =   0   'False
  66.       FontUnderline   =   0   'False
  67.       Height          =   2190
  68.       Left            =   120
  69.       TabIndex        =   0
  70.       TabStop         =   0   'False
  71.       Top             =   240
  72.       Width           =   7095
  73.    End
  74.    Begin Label Label1 
  75.       BackColor       =   &H00808080&
  76.       Caption         =   "To revise    sources"
  77.       Height          =   375
  78.       Left            =   3360
  79.       TabIndex        =   6
  80.       Top             =   2520
  81.       Width           =   975
  82.    End
  83. End
  84.  
  85.  
  86. Sub add_ok_Click ()
  87.  
  88.     mousepointer = HOURGLASS
  89.     s_source_list_dblclick
  90.     sources_form.Hide
  91.     
  92. End Sub
  93.  
  94. Sub Form_Load ()
  95.  
  96.     z = DoEvents()
  97.  
  98.     If sources_loaded Then
  99.         Exit Sub
  100.     End If
  101.  
  102.     Open "wais.src" For Input As 2
  103.     x = 0
  104.     While Not EOF(2)
  105.         Line Input #2, source$
  106.  
  107.         c = 1
  108.         While c <> 0
  109.             c = InStr(source$, Chr$(9))
  110.             If c > 0 Then
  111.                 Mid$(source$, c, 1) = " "
  112.             End If
  113.         Wend
  114.  
  115.         c1 = InStr(source$, " ")
  116.         s_database(x) = Mid$(source$, 1, c1 - 1)
  117.  
  118.         c2 = InStr(c1 + 1, source$, " ")
  119.         s_port(x) = Val(Mid$(source$, c1 + 1, c2 - c1))
  120.  
  121.         c3 = InStr(c2 + 1, source$, " ")
  122.         s_service(x) = Mid$(source$, c2 + 1, c3 - c2 - 1)
  123.  
  124.         s_source_list.AddItem Right$(source$, Len(source$) - c3)
  125.  
  126.         x = x + 1
  127.     
  128.     Wend
  129.     
  130.     Close (2)
  131.  
  132.     sources_loaded = True
  133.     
  134.     mousepointer = DEFAULT
  135.  
  136. End Sub
  137.  
  138. Sub Form_Paint ()
  139.  
  140.     mousepointer = DEFAULT
  141.  
  142. End Sub
  143.  
  144. Sub s_source_list_dblclick ()
  145.  
  146.     Dim x As Integer
  147.     Dim src As Integer
  148.     Dim ssrc As Integer
  149.     
  150.     If s_source_list.listindex > -1 Then
  151.  
  152.         src = question_form.source_list.listcount
  153.         ssrc = s_source_list.listindex
  154.  
  155.         For x = 0 To src - 1
  156.             If src_port(x) = s_port(ssrc) And src_service(x) = s_service(ssrc) And src_database(x) = s_database(ssrc) Then
  157.                 Exit Sub
  158.             End If
  159.         Next x
  160.  
  161.         src_port(src) = s_port(ssrc)
  162.         src_service(src) = s_service(ssrc)
  163.         src_database(src) = s_database(ssrc)
  164.         question_form.source_list.AddItem s_source_list.text
  165.     
  166.     End If
  167.  
  168. End Sub
  169.  
  170. Sub src_add_Click ()
  171.  
  172.     new_src_form.Show 1
  173.  
  174. End Sub
  175.  
  176. Sub src_change_Click ()
  177.  
  178.     src = s_source_list.listindex
  179.     If src = -1 Then
  180.         Exit Sub
  181.     End If
  182.     
  183.     new_src_form.s_add_title.text = s_source_list.text
  184.     port$ = Str$(s_port(src))
  185.     new_src_form.s_add_port.text = Right$(port$, Len(port$) - 1)
  186.     new_src_form.s_add_server.text = s_service(src)
  187.     new_src_form.s_add_database.text = s_database(src)
  188.  
  189.     new_src_form.Show 1
  190.     
  191.     If s_change_accepted Then
  192.         
  193.         For x = s_source_list.listindex To s_source_list.listcount
  194.             s_port(x) = s_port(x + 1)
  195.             s_service(x) = s_service(x + 1)
  196.             s_database(x) = s_database(x + 1)
  197.         Next x
  198.  
  199.         s_source_list.RemoveItem s_source_list.listindex
  200.     
  201.     End If
  202.     
  203. End Sub
  204.  
  205. Sub src_delete_Click ()
  206.  
  207.     If s_source_list.listindex = -1 Then
  208.         MsgBox ("Please select a source to delete")
  209.         Exit Sub
  210.     End If
  211.  
  212.     If MsgBox("     Are you sure?", 1) = 1 Then
  213.         For x = s_source_list.listindex To s_source_list.listcount
  214.             s_port(x) = s_port(x + 1)
  215.             s_service(x) = s_service(x + 1)
  216.             s_database(x) = s_database(x + 1)
  217.         Next x
  218.         
  219.         s_source_list.RemoveItem s_source_list.listindex
  220.     End If
  221.  
  222. End Sub
  223.  
  224. Sub src_use_Click ()
  225.     
  226.     s_source_list_dblclick
  227.  
  228. End Sub
  229.  
  230.